package com.google.code.HomeSeek;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.app.Service;
import android.os.IBinder;
import android.telephony.TelephonyManager;

import android.util.Log;

public class InstallerService extends Service {

	static final String LOG_ID = "HomeSeek.InstallerService";

	ScreenReceiver myReceiver = null;

	@Override
	public void onCreate() {
		IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
		if (myReceiver == null)
			myReceiver = new ScreenReceiver();
		if (myReceiver.telephone == null)
			myReceiver.telephone = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
		registerReceiver(myReceiver, filter);
		Log.d(LOG_ID, "Receiver registered");
	}
	
	public IBinder onBind(android.content.Intent intent) {
		// do nothing
		return null;
	}
	
	@Override
	public void onDestroy() {
		unregisterReceiver(myReceiver);
		Log.d(LOG_ID, "Receiver unregistered");
	}
}
